<?php
/**
 * @author Anh Nguyen
 * @copyright 2012
 */
  
 defined('APP') or die('Denied access !');
 
 class Loader
 {
    public function library($name, $return = true)
    {
        $class = strtolower($name);
        $path = LIB_PATH . DS . $class . '.php';
        if( !file_exists($path)) {
            header('Location: ' . Core::site_url());
        }
        require_once $path;
        if($return == true) {
            return new $name();
        }
        
    }
    
    public function helper($name)
    {
        $class = strtolower($name);
        $path = HELP_PATH . DS . $class . '.php';
        if( !file_exists($path)) {
            header('Location: ' . Core::site_url());
        }
        require_once $path;
    }
 }
?>